'use strict'

const path = require('node:path')
const {getBaseDir} = require('ee-core/ps')

/**
 * 默认配置
 */
module.exports = () => {
    return {
        openDevTools: false,
        singleLock: true,
        windowsOption: {
            title: 'electron-egg',
            width: 980,
            height: 650,
            minWidth: 980,
            minHeight: 650,
            webPreferences: {
                // webSecurity: false,
                contextIsolation: false, // false -> 可在渲染进程中使用electron的api，true->需要bridge.js(contextBridge)
                nodeIntegration: true,
                //preload: path.join(getElectronDir(), 'preload', 'bridge.js'),
            },
            fullscreenable: false,
            frame: false,
            hasShadow: true,
            transparent: false,
            show: false,//主窗口延迟加载，无白屏
            icon: path.join(getBaseDir(), 'public', 'images', 'logo-32.png'),
        },
        logger: {
            level: 'INFO',
            outputJSON: false,
            appLogName: 'ee.log',
            coreLogName: 'ee-core.log',
            errorLogName: 'ee-error.log'
        },
        remote: {
            enable: false,
            url: 'http://electron-egg.kaka996.com/'
        },
        socketServer: {
            enable: false,
            port: 7070,
            path: "/socket.io/",
            connectTimeout: 45000,
            pingTimeout: 30000,
            pingInterval: 25000,
            maxHttpBufferSize: 1e8,
            transports: ["polling", "websocket"],
            cors: {
                origin: true,
            },
            channel: 'socket-channel'
        },
        httpServer: {
            enable: false,
            https: {
                enable: false,
                key: '/public/ssl/localhost+1.key',
                cert: '/public/ssl/localhost+1.pem'
            },
            host: '127.0.0.1',
            port: 7071,
        },
        mainServer: {
            indexPath: '/public/dist/index.html',
            channelSeparator: '/',
        },
        autoUpdater: {
            windows: true,
            macOS: false,
            linux: false,
            options: {
                provider: 'generic',
                url: 'https://images.ep.damanzj.com/release'
            },
            force: false,
        },
        tray: {
            title: 'electron-egg',
            icon: '/public/images/tray.png'
        }
    }
}
